﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true"
    CodeFile="ReceivePort.aspx.cs" Inherits="BTOps_ReceivePort" Title="BizTalk Server Administration Web Console - Receive Ports"
    StylesheetTheme="Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Label ID="lblPageHeader" runat="server" CssClass="PageHeader" Text="Receive Ports" /><br />
    <br />
    <strong>Applications:</strong>
    <asp:DropDownList ID="ddlApps" runat="server" AutoPostBack="True" DataSourceID="ApplicationDS"
        DataTextField="Name" DataValueField="Name" AppendDataBoundItems="True" OnDataBound="ddlApps_DataBound">
        <asp:ListItem Text="Select..." Value="" />
    </asp:DropDownList>
    <asp:Panel ID="pnlReceivePortInfo" runat="server" Visible="false">
        <br />
        <br />
        <asp:GridView ID="grdReceivePorts" runat="server" EmptyDataText="No receive ports found..."
            AutoGenerateColumns="False" EnableViewState="False" DataSourceID="ReceivePortDS"
            DataKeyNames="Name">
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="SelectLinkButton" runat="server" CausesValidation="False" CommandName="Select"
                            Text="Select" />&nbsp;
                        <asp:LinkButton ID="DeleteLinkButton" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="Delete" OnClientClick="return confirm('Do you really want to delete this receive port?');" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Name" HeaderText="Name" />
                <asp:CheckBoxField DataField="TwoWay" HeaderText="Two Way">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:HyperLinkField DataNavigateUrlFields="ApplicationName,Name" DataNavigateUrlFormatString="ReceiveLocation.aspx?app={0}&amp;port={1}"
                    Text="Receive Location" />
            </Columns>
        </asp:GridView>
    </asp:Panel>
    <asp:Panel ID="pnlReceivePortDetail" runat="server" Visible="false">
        <br />
        <br />
        <asp:Label ID="lblReceivePortDetay" runat="server" CssClass="PageHeader" Text="Receive Port Details" /><br />
        <table border="0" cellspacing="0" cellpadding="5">
            <tr>
                <td valign="top">
                    <asp:DetailsView ID="dvwReceivePort" runat="server" DataSourceID="ReceivePortDetailsDS"
                        AutoGenerateRows="False" DataKeyNames="Name" EnableViewState="False" OnDataBound="dvwReceivePort_DataBound">
                        <Fields>
                            <asp:TemplateField HeaderText="Name">
                                <ItemTemplate>
                                    <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>' ValidationGroup="ReceivePort" />
                                    <asp:RequiredFieldValidator ID="NameRequired" runat="server" ControlToValidate="txtName"
                                        Display="Dynamic" ErrorMessage="Receive port name is required" ValidationGroup="ReceivePort">*</asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="txtName" runat="server" ValidationGroup="ReceivePort" />
                                    <asp:RequiredFieldValidator ID="NameRequired" runat="server" ControlToValidate="txtName"
                                        Display="Dynamic" ErrorMessage="Receive port name is required" ValidationGroup="ReceivePort">*</asp:RequiredFieldValidator>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:CheckBoxField DataField="TwoWay" HeaderText="Two way" />
                            <asp:CheckBoxField DataField="RouteFailed" HeaderText="Route failed message" />
                            <asp:TemplateField HeaderText="Authentication">
                                <ItemTemplate>
                                    <asp:DropDownList ID="ddlAuthentication" runat="server" ValidationGroup="ReceivePort"
                                        SelectedValue='<%# Eval("Authentication") %>' Enabled="false">
                                        <asp:ListItem Value="0">No authentication</asp:ListItem>
                                        <asp:ListItem Value="1">Drop messages if authentication fails</asp:ListItem>
                                        <asp:ListItem Value="2">Keep messages if authentication fails</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlAuthentication" runat="server" ValidationGroup="ReceivePort"
                                        SelectedValue='<%# Bind("Authentication") %>'>
                                        <asp:ListItem Value="0">No authentication</asp:ListItem>
                                        <asp:ListItem Value="1">Drop messages if authentication fails</asp:ListItem>
                                        <asp:ListItem Value="2">Keep messages if authentication fails</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:DropDownList ID="ddlAuthentication" runat="server" ValidationGroup="ReceivePort"
                                        SelectedValue='<%# Bind("Authentication") %>'>
                                        <asp:ListItem Value="0">No authentication</asp:ListItem>
                                        <asp:ListItem Value="1">Drop messages if authentication fails</asp:ListItem>
                                        <asp:ListItem Value="2">Keep messages if authentication fails</asp:ListItem>
                                    </asp:DropDownList>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Description">
                                <ItemTemplate>
                                    <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtDescription" runat="server" Columns="40" TextMode="MultiLine"
                                        ValidationGroup="ReceivePort" Text='<%# Bind("Description") %>' />
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="txtDescription" runat="server" Columns="40" TextMode="MultiLine"
                                        ValidationGroup="ReceivePort" />
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowInsertButton="True" ValidationGroup="ReceivePort" ShowEditButton="True" />
                        </Fields>
                    </asp:DetailsView>
                </td>
                <td valign="top">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="ReceivePort" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:ObjectDataSource ID="ApplicationDS" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="ListApplicationNames" TypeName="BTApplicationOperations" />
    <asp:ObjectDataSource ID="ReceivePortDS" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="ListReceivePorts" TypeName="BTReceivePortOperations" DataObjectTypeName="BTOps.BTReceivePort"
        DeleteMethod="DeleteReceivePort">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlApps" Name="applicationName" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ReceivePortDetailsDS" runat="server" DataObjectTypeName="BTOps.BTReceivePort"
        InsertMethod="CreateReceivePort" OldValuesParameterFormatString="original_{0}"
        SelectMethod="ReceivePortByName" TypeName="BTReceivePortOperations" UpdateMethod="UpdateReceivePort"
        OnInserting="ReceivePortDetailsDS_Inserting" OnUpdating="ReceivePortDetailsDS_Updating">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlApps" Name="applicationName" PropertyName="SelectedValue"
                Type="String" />
            <asp:ControlParameter ControlID="grdReceivePorts" Name="name" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
